<html>
<head>
<title>Embedding Reportico</title>
<link rel="stylesheet" type="text/css" href="../media/style.css">
</head>
<body>

<table border="0" cellspacing="0" cellpadding="0" height="48" width="100%">
  <tr>
    <td width="100%">
			<table width="100%" height="78" border="0" align="left" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" id="topnav">
			<tr>
				<!-- Header Side -->
				<td width="17">
					<img height="78" src="media/reportico100.png"/>
				</td>
				<td align="right"></td>
				<td align="center">
					<table width="100%" height="60" border="0" align="left" cellpadding="0" cellspacing="0">
						<tr>
							<td valign="top" align="left">
							<img src="media/repbanner.png"/></td>
							</td>
						</tr>
						<tr>
							<td align="center" valign="bottom" class="topmenucell">
								<nobr>
								&nbsp;
								</nobr>
							</td>
						</tr>
					</table>
				</td>
				<td width="103" class="toplogincell">
					&nbsp;
				</td>
			</tr>
			</table>
</td>
  </tr>
  <!--tr>
    <td class="header_top">reportico</td>
  </tr-->
  <tr><td class="header_line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
  <tr>
    <td class="header_menu">
  		  [ <a href="../classtrees_reportico.html" class="menu">class tree: reportico</a> ]
		  [ <a href="../elementindex_reportico.html" class="menu">index: reportico</a> ]
		  [ <a href="../elementindex.html" class="menu">all elements</a> ]
    </td>
  </tr>
  <tr><td class="header_line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
</table>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="200" class="menu">
      <b>Packages:</b><br />
              <a href="../li_reportico.html">reportico</a><br />
            <br /><br />
		<b>Tutorials/Manuals:</b><br />
					<strong>Package-level:</strong>
							<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.pkg.html">Reportico Tutorial And User Manual</a>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.manual.pkg.html">Reportico User Manual</a>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.quickstart.pkg.html">Reportico Installation</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.gettingstarted.pkg.html">Getting Started</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.structure.pkg.html">Reportico Installation Structure</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.using.pkg.html">Configuring Reportico - System Parameters</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.embedding.pkg.html">Embedding Reportico</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.security.pkg.html">Reportico Security</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.language.pkg.html">Language Support</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.projects.pkg.html">Projects</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.importlink.pkg.html">Importing and linking from reports</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.menus.pkg.html">Report Menus</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.prepare.pkg.html">Report Preparation and Execution</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.design.pkg.html">Report Design Mode</a>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.format.pkg.html">The Design Format Menu</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.customcode.pkg.html">Custom Source Code</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.qrydet.pkg.html">The Query Details Menu</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.assign.pkg.html">The Assignments Menu</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.criteria.pkg.html">The Criteria Menu</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.output.pkg.html">The Output Menu</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.webservices.pkg.html">Turning Reports into Web Services (currently unavailable)</a>
</ul>
</li></ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.faq.pkg.html">Reportico FAQ</a>
</ul>
</li></ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.howto.pkg.html">Reportico Tutorial</a>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.tutorial1.pkg.html">Tutorial No.1 - The Film Listing Report</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.tutorial1_1.pkg.html">Tutorial 1 Stage 1 - Creating a basic report</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.tutorial1_2.pkg.html">Tutorial 1 Stage 2 - Creating User Entry Criteria</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.tutorial1_3.pkg.html">Tutorial 1 Stage 3 - Working with expressions using assignments</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.tutorial1_4.pkg.html">Tutorial 1 Stage 4 - Working with groups</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.tutorial1_5.pkg.html">Tutorial 1 Stage 5 - Including database graphics into the report and generating drilldowns</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.tutorial2_1.pkg.html">Tutorial 2 - Creating the loan history report</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.tutorial3_1.pkg.html">Tutorial 3 - The Monthly Returns Report</a>
</ul>
<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.tutorial4_1.pkg.html">Tutorial 4 - The Late Returns Summary report</a>
</ul>
</li></ul>
</li></ul>

							<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.appendix1.pkg.html">Appendix 1 - Reportico Project Configuration parameters</a>
</ul>

							<ul>
	<li type="square"><a href="../reportico/tutorial_reportico.appendix2.pkg.html">Appendix 2 - Reportico URL request parameters</a>
</ul>

									                        <b>Files:</b><br />
      	  <div class="package">
			<a href="../reportico/_reportico.php.html">		reportico.php
		</a><br>
	  </div><br />
      
                </td>
    <td>
      <table cellpadding="10" cellspacing="0" width="100%" border="0"><tr><td valign="top">

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10%" align="left" valign="bottom"><a href=
"../reportico/tutorial_reportico.using.pkg.html">Prev</a></td>
<td width="80%" align="center" valign="bottom"></td>
<td width="10%" align="right" valign="bottom"><a href=
"../reportico/tutorial_reportico.security.pkg.html">Next</a></td>
</tr>
</table>
<span><a name="format.using"></a><h2 class="title">Embedding Reportico</h2><a name="using.embedding"></a><h3 class="title">Embedding a report within a web
    page</h3><p>In order to place a fully functional report within your own web pages you need to include code similar to the contents of the run.php within your script. It is necessary therefore to include reportico by providing its fully pathed position. When embedding you probably also want to customise how Reportico appears ot the user. For example you may want to include a single report output within a div, or include a single graph within a div or give the user the ability to enter criteria for a singl erpeort and execute it. You may want to give user access to a single report suite but disallow entry to report menus.</p>
<p>You can also use any of the parameters described in the above runner script for configuring your page.</p>
<p>An example web page may
    look as follows :</p>
<p><code><pre>
    &lt;HTML&gt;
      &lt;BODY&gt;

          ...... Your web content ...... 

          &lt;!-- Start of Reportico Report --&gt;
          &lt;?php
            set_include_path('{PATH TO REPORTICO DIRECTORY}');
            require_once('reportico.php'); 
            $a = new reportico();
            $a-&gt;embedded_report = true;
            $a-&gt;forward_url_get_parameters = &quot;x1=y1&amp;x2=y2&quot;; 
            $a-&gt;execute();
          ?&gt; 
          &lt; !-- End of Reportico Report --&gt;

          ...... More web content ......

      &lt;/BODY&gt;
    &lt;/HTML&gt;
</pre></code></p>
<p>Note the embedded report is very important when embedding and needs to be set to true.</p><hr />
    <a name="using.controllingaccess"></a><h3 class="title">Control user access to projects, reports</h3><p>Using a combination of the <strong>initial_execute_mode</strong> and <strong>access_mode</strong> properties, it is possible to take a user to a specific report or specific report menu to execute report, execute a report to show just the graphs, just the report detail or just the group headers, for example. When generating report out you have control whether the user has a return button to go back to criteria entry.</p>
<p><strong>initial_execute_mode</strong> indicates what type of screen user is first taken into. Valid values for initial_execute_mode are ADMIN, MENU, PREPARE or EXECUTE. ADMIN takes user to the ADMIN page, MENU takes user to a report menu ( an initial project must be specifiedd ), PREPARE takes user to the criteria entry screen of a specfic report ( project and report must be specified ) and EXECUTE runs a specified report ( project and report must be specified ).</p>
<p>Allow using the properties <strong>initial_project</strong> and <strong>initial_report</strong> take users directly to the specified report suite and report files respectively. If a project is controlled by a password this can be provided in the initial_project_password so the user doesnt have to type the password in.</p>
<p><strong>access_mode</strong> indicates what Reportico pages and functions a user has access to. Valid options are</p>
      <ul><li><p><strong>FULL</strong></p><p>provides access to the Admin Page and the ability to enter Design mode, if users give the correct Admin password</p></li>
          <li><p><strong>ALLPROJECTS</strong></p><p>users can use admin page to select a project (but not be able to enter admin mode). Users can select and run reports and navigate between report output, report criteria and the report project menu where users can choose a report to run. Dropdown menus ( see documentation ) can be used to swap between project reports and projects if required</p></li>
          <li><p><strong>ONEPROJECT</strong></p><p>users can use a single project, select and run reports and navigate between report output, report criteria and the report project menu where users can choose a report to run. Swapping between project menus in rhis mode must also be down by a dropdown menu (see documentation for how to do this)</p></li>
          <li><p><strong>ONEREPORT</strong></p><p>user gets access to a single report's criteria entry mode and can run the report and then jump back to criteria entry again</p></li>
          <li><p><strong>REPORTOUTPUT</strong></p><p>the output of a single report is presented and the user may not navigate to any other Reportico page</p></li></ul>
<p>Example 1 - Run a single report salesforecast,xml in project sales (which is password protected with password &quot;password&quot; and run to HTML output.</p>
<p><code><pre>
   &lt;HTML&gt;
      &lt;BODY&gt;

          ...... Your web content ...... 

          &lt;!-- Start of Reportico Report --&gt;
          &lt;?php
            require_once('{FULL PATH TO REPORTICO DIRECTORY}/reportico.php'); 
            $q = new reportico();
            $q-&gt;initial_project = &quot;sales&quot;;
            $q-&gt;initial_project_password = &quot;password&quot;;
            $q-&gt;initial_report = &quot;salesforecast.xml&quot;;
            $q-&gt;initial_execute_mode = &quot;EXECUTE&quot;;
            $q-&gt;initial_output_format = &quot;HTML&quot;;
            $q-&gt;access_mode = &quot;REPORTOUTPUT&quot;;
            $q-&gt;embedded_report = true;
            $q-&gt;execute();
          ?&gt; 
          &lt; !-- End of Reportico Report --&gt;

          ...... More web content ......

      &lt;/BODY&gt;
    &lt;/HTML&gt;
</pre></code></p>  
<p>Example 2 - Run the menu for project &quot;stock&quot; with no access to menu</p>
<p><code><pre>
    &lt;HTML&gt;
      &lt;BODY&gt;

          ...... Your web content ...... 

          &lt;!-- Start of Reportico Report --&gt;
          &lt;?php
            require_once('{FULL PATH TO REPORTICO DIRECTORY}/reportico.php'); 
            $q = new reportico();
            $q-&gt;initial_project = &quot;stock&quot;;
            $q-&gt;initial_project_password = &quot;password&quot;;
            $q-&gt;initial_execute_mode = &quot;MENU&quot;;
            $q-&gt;access_mode = &quot;SInGLEPROJECT&quot;;
            $q-&gt;embedded_report = true;
            $q-&gt;execute();
          ?&gt; 
          &lt; !-- End of Reportico Report --&gt;

          ...... More web content ......

      &lt;/BODY&gt;
    &lt;/HTML&gt;
</pre></code></p><hr />
    <a name="using.passsql"></a><h3 class="title">Passing Reportico an SQL query</h3><p>When running reportico from an embedded page or via custom scripts it is possible to avoid the need to write a report and just give Reportico the SQL.
This is possible in two ways:</p>

<p>Option 1 - Use the initial_sql parameter and the initial_project parameter. 
Note that the column aliases are useful to provide more meaning ful column titles ( other column titles will be derived by changing any underscores to spaces and having word initial letters capitalized.</p>
<p><code><pre>
   &lt;HTML&gt;
      &lt;BODY&gt;

          ...... Your web content ...... 

          &lt;!-- Start of Reportico Report --&gt;
          &lt;?php
            require_once('{FULL PATH TO REPORTICO DIRECTORY}/reportico.php'); 
            $q = new reportico();
            $q-&gt;initial_project_password = &quot;password&quot;; // If required
            $q-&gt;initial_sql = &quot;SELECT column1 AS columntitle1, column2 AS columntitle2, expression() as columntitle3 FROM table&quot;;
            $q-&gt;initial_output_format = &quot;HTML&quot;;
            $q-&gt;access_mode = &quot;REPORTOUTPUT&quot;;
            $q-&gt;embedded_report = true;
            $q-&gt;execute();
          ?&gt; 
          &lt; !-- End of Reportico Report --&gt;

          ...... More web content ......

      &lt;/BODY&gt;
    &lt;/HTML&gt;
</pre></code></p>  
<p>Option 2 - use the importSQL feature - this provides extra customisation features which will be documented later ( the idea being to be able to programatically build a report from scratch).</p>
<p><code><pre>
    &lt;HTML&gt;
      &lt;BODY&gt;

          ...... Your web content ...... 

          &lt;!-- Start of Reportico Report --&gt;
          &lt;?php
            require_once('{FULL PATH TO REPORTICO DIRECTORY}/reportico.php'); 
            $q = new reportico();
            $q-&gt;initial_project = &quot;stock&quot;;
            $q-&gt;initial_project_password = &quot;password&quot;; // if required
            $q-&gt;importSQL(&quot;SELECT column1 AS columntitle1, column2 AS columntitle2 FROM table&quot;;
            $q-&gt;get_column(&quot;column1&quot;)-&gt;set_attribute(&quot;column_display&quot;,&quot;hide&quot;);
            $q-&gt;get_column(&quot;column1&quot;)-&gt;set_attribute(&quot;column_title&quot;,&quot;Custom Title&quot;);
            $q-&gt;set_attribute(&quot;ReportTitle&quot;,&quot;New Report Title&quot;);

            $q-&gt;embedded_report = true;
            $q-&gt;execute();
          ?&gt; 
          &lt; !-- End of Reportico Report --&gt;

          ...... More web content ......

      &lt;/BODY&gt;
    &lt;/HTML&gt;
</pre></code></p><hr />

    <a name="using.controllingoutput"></a><h3 class="title">Controlling Output</h3><p>When directly taking a user to report output or criteria entry you can control certain output features.</p>

<p>To control whether output is provided in HTML, PDF, CSV, XML or JSON format just set the initial_output_format property to HTML, PDF, CSV, XML or JSON respectively For example :-</p>
<p><code><pre>
            $q-&gt;initial_output_format = &quot;PDF&quot;;
</pre></code></p>  
<p>To control whether output shows or hides the report detail/graphs, criteria etc ...</p>
<p><code><pre>
            $q-&gt;initial_show_detail = &quot;hide&quot;;
            $q-&gt;initial_show_graph = &quot;show&quot;;
            $q-&gt;initial_show_group_headers = &quot;hide&quot;;
            $q-&gt;initial_show_group_trailers = &quot;hide&quot;;
            $q-&gt;initial_show_column_headers = &quot;hide&quot;;
            $q-&gt;initial_show_criteria = &quot;hide&quot;;
</pre></code></p>  

<p>To control whether reports are generated as a single line per report output in multi-column format or a page of data with one line per column value, set the initial_output_style to either TABLE or FORM, e.g.</p>
<p><code><pre>
    $q-&gt;initial_output_style = &quot;FORM&quot;;
</pre></code></p>  

<p>To provide a refresh button set the following :-</p>
<p><code><pre>
    $q-&gt;show_refresh_button = true;
</pre></code></p><hr />

<a name="using.styling"></a><h3 class="title">Reportico Styling</h3><p>Reportico by default is styled according to Bootstrap 3, a copy of which is supplied with Reportico, which Reportico loads up.
However when embedding into a web page this may not be desirable. If your web page is not compatible with Bootstrap then you can revert to Reportico Classic styling by setting bootstrap_styles = false. 
If your web pages already have Bootstrap 3 loaded then set bootstrap styles to &quot;3&quot; and set bootstrap_preloaded. If your site has bootstrap 2 then set this to &quot;2&quot;.
    <code><pre>
        $q-&gt;bootstrap_styles = &quot;3&quot;; // Set to false for reportico classic, or 2 to use bootstrap 2 styling conventions
        $q-&gt;bootstrap_preloaded = false; // Set to true to use existing site bootstrap
</pre></code></p><hr />


<a name="using.passparameters"></a><h3 class="title">Passing criteria parameters within embedded reports</h3><p>One way of passing parameters reports is to use the &quot;MANUAL_&quot; method mechanism of passing parameters within the $_REQUEST record. A better way when embedding reportico or generating custom reportico scritps is to use the <strong>initial_execution_parameters</strong> array property. Just biuld this array up with the key of the criteria name ( as specified in the report criteria definitions ) and the criteria value you want used witihn the report query. For date ranges use the &quot;-&quot; notation and for multiple options for a list or lookup type criteria specify the values with comma separated values.</p>

<p>The following example runs a report for specified countries and covers the dates between the start of 2013 and today :-</p>
<p><code><pre>
            $q-&gt;initial_execution_parameters = array();
            $q-&gt;initial_execution_parameters[&quot;country&quot;] = &quot;Italy,Australia&quot;;
            $q-&gt;initial_execution_parameters[&quot;invoice_dates&quot;] = &quot;2013-01-01-TODAY&quot;;
            $q-&gt;execute();
</pre></code></p><hr />

<a name="using.connectframework"></a><h3 class="title">Connecting to a framework or CMS database</h3><p>Reportico can be embedded into PHP frameworks and CMS. In this case you may want to use the database connection settings from the framework rather than having to specify them again in your project definition. To achieve this, when you create to configure your project, you need to choose the &quot;framework&quot; database driver option. Then in your calling script, before the Reportico execute() call, you need to specify the following databse constants ( quite often CMSs or frameworks provide functions to access these values :-</p>

<p><code><pre>
    define('SW_FRAMEWORK_DB_DRIVER','&lt;DATABASETYPE&gt;'); e.g. pdo_mysql, pdo_pgsql, pdo_mssql etc
    define('SW_FRAMEWORK_DB_USER', $myframework-&gt;getuser());
    define('SW_FRAMEWORK_DB_PASSWORD',$myframework-&gt;getPassword());
    define('SW_FRAMEWORK_DB_HOST',$myframework-&gt;getHostName()); // Use ip:port to specifiy a non standard port
    define('SW_FRAMEWORK_DB_DATABASE',$myframework-&gt;getDatabase());
    $q-&gt;execute();
</pre></code></p><hr />

<a name="using.ajaxmode"></a><h3 class="title">Turning on AJAX Reportico operation</h3><p>AJAX mode is turned on by default.
In AJAX mode, all button presses are made as an AJAX call meaning that there is no full page refresh performed. This makes its operation look nicer when embedded in complex web pages. It also allows it to work alongside other web apps in a page.</p>
<p>To include reportico in this fashion you need to set a Reportico property alongside the other paramters. Just set For example :-</p>

<p><code><pre>
    $q-&gt;reportico_ajax_mode = true;
</pre></code></p><hr />

<a name="using.dynamicgrids"></a><h3 class="title">Dynamic Grids</h3><p>You can turn on dynamic sortable, searchable, pageable grids with the following parameters -
    <code><pre>
    $q-&gt;dynamic_grids = true;
    $q-&gt;dynamic_grids_sortable = true;
    $q-&gt;dynamic_grids_searchable = true;
    $q-&gt;dynamic_grids_paging = false;
    $q-&gt;dynamic_grids_page_size = 10;
</pre></code></p><hr />

<a name="using.projectmenus"></a><h3 class="title">Report Menus - Static And Dropdown</h3><p>When embedding it is easier to specify the menu items available to the user both in the dropdown control panel at the top and in the front end menu page.
Just set up the following arrays :-
    <code><pre>
    // Static - main menu definition
    $q-&gt;static_menu = array (
	    array ( &quot;report&quot; =&gt; &quot;an_xml_reportfile1&quot;, &quot;title&quot; =&gt; &quot;&lt;AUTO&gt;&quot; ),
	    array ( &quot;report&quot; =&gt; &quot;another_reportfile&quot;, &quot;title&quot; =&gt; &quot;&lt;AUTO&gt;&quot; ),
	    array ( &quot;report&quot; =&gt; &quot;&quot;, &quot;title&quot; =&gt; &quot;BLANKLINE&quot; ),
	    array ( &quot;report&quot; =&gt; &quot;anotherfreportfile&quot;, &quot;title&quot; =&gt; &quot;Custom Title&quot; ),
	    array ( &quot;report&quot; =&gt; &quot;&quot;, &quot;title&quot; =&gt; &quot;BLANKLINE&quot; ),
	    array ( &quot;report&quot; =&gt; &quot;andanother&quot;, &quot;title&quot; =&gt; &quot;Another Custom Title&quot; ),
	);

    // To auto generate a static menu from all the xml report files in the project use
    $q-&gt;static_menu = array ( array ( &quot;report&quot; =&gt; &quot;.*\.xml&quot;, &quot;title&quot; =&gt; &quot;&lt;AUTO&gt;&quot; ) );
    
    // To hide the static report menu
    $q-&gt;static_menu = array ();

    // Dropdown Menu definition
    $q-&gt;dropdown_menu = array(
                    array ( 
                        &quot;project&quot; =&gt; &quot;projectname&quot;,
                        &quot;title&quot; =&gt; &quot;dropdown menu 1 title&quot;,
                        &quot;items&quot; =&gt; array (
                            array ( &quot;reportfile&quot; =&gt; &quot;report&quot; ),
                            array ( &quot;reportfile&quot; =&gt; &quot;anotherreport&quot; ),
                            )
                        ),
                    array ( 
                        &quot;project&quot; =&gt; &quot;projectname&quot;,
                        &quot;title&quot; =&gt; &quot;dropdown menu 2 title&quot;,
                        &quot;items&quot; =&gt; array (
                            array ( &quot;reportfile&quot; =&gt; &quot;report&quot; ),
                            array ( &quot;reportfile&quot; =&gt; &quot;anotherreport&quot; ),
                            )
                        ),
                );


</pre></code></p><hr />

<a name="using.hidingui"></a><h3 class="title">Hiding Reportico UI features</h3><p>It is possible to turn off the report output title, some of the control panel buttons and checkboxes in crtieria entry mode and some of the the menus by setting any of the following to &quot;hide&quot;
    <code><pre>
    $q-&gt;output_template_parameters[&quot;show_hide_navigation_menu&quot;] = &quot;show&quot;;
    $q-&gt;output_template_parameters[&quot;show_hide_dropdown_menu&quot;] = &quot;show&quot;;
    $q-&gt;output_template_parameters[&quot;show_hide_report_output_title&quot;] = &quot;show&quot;;
    $q-&gt;output_template_parameters[&quot;show_hide_prepare_section_boxes&quot;] = &quot;show&quot;;
    $q-&gt;output_template_parameters[&quot;show_hide_prepare_pdf_button&quot;] = &quot;show&quot;;
    $q-&gt;output_template_parameters[&quot;show_hide_prepare_html_button&quot;] = &quot;show&quot;;
    $q-&gt;output_template_parameters[&quot;show_hide_prepare_print_html_button&quot;] = &quot;show&quot;;
    $q-&gt;output_template_parameters[&quot;show_hide_prepare_csv_button&quot;] = &quot;show&quot;;
    $q-&gt;output_template_parameters[&quot;show_hide_prepare_page_style&quot;] = &quot;show&quot;;

</pre></code></p><hr />


<a name="using.controllingparameters"></a><h3 class="title">Passing criteria parameters within embedded reports</h3><p>One way of passing parameters reports is to use the &quot;MANUAL_&quot; method mechanism of passing parameters within the $_REQUEST record. A better way when embedding reportico or generating custom reportico scritps is to use the <strong>initial_execution_parameters</strong> array property. Just biuld this array up with the key of the criteria name ( as specified in the report criteria definitions ) and the criteria value you want used witihn the report query. For date ranges use the &quot;-&quot; notation and for multiple options for a list or lookup type criteria specify the values with comma separated values.</p>

<p>The following example runs a report for specified countries and covers the dates between the start of 2013 and today :-</p>
<p><code><pre>
            $q-&gt;initial_execution_parameters = array();
            $q-&gt;initial_execution_parameters[&quot;country&quot;] = &quot;Italy,Australia&quot;;
            $q-&gt;initial_execution_parameters[&quot;invoice_dates&quot;] = &quot;2013-01-01-TODAY&quot;;
            $q-&gt;execute();
</pre></code></p><hr />


<a name="using.multiplereports"></a><h3 class="title">Namespaces - running more than one Reportico report on a single web page</h3><p>It is possible to embedded reportico so that it generates several instances on a single page. You could for example chain report output together or use the hide and show options to run several reports with graphs to present only the graphs in a kind of dashboard.</p>
<p>To do this you need to use the namespace property to ensure that successive embedded reports do not get their sessions confused. You also need to create a new instance of reportico for each successive report to avoid other conflicts.</p>
<p>Note that reportico_ajax_mode is set to true. If you want to allow the user to interact wih more than one report on a page ( enter criteria, select from menus ) then you need this option to avoid full screen refreshes.</p>
<p>Note that currently you cannot chain together reports from different projects, this will be addressed in a future release.</p>
<p>This example chains together two reports in graph mode, note the use of the namespace property :-</p>

<p><code><pre>
    require_once('&lt;PATHTOREPORTICO&gt;/reportico.php');
    
    // Run first report
    $q = new reportico();
    $q-&gt;allow_debug = true;
    $q-&gt;reportico_ajax_mode = true;
    $q-&gt;initial_project = &quot;myproject&quot;;
    $q-&gt;initial_project_password = &quot;password&quot;;
    $q-&gt;initial_report = &quot;graph1.xml&quot;;
    $q-&gt;initial_execute_mode = &quot;EXECUTE&quot;;
    $q-&gt;initial_show_detail = &quot;hide&quot;;
    $q-&gt;initial_show_graph = &quot;show&quot;;
    $q-&gt;initial_show_group_headers = &quot;hide&quot;;
    $q-&gt;initial_show_group_trailers = &quot;hide&quot;;
    $q-&gt;initial_show_column_headers = &quot;hide&quot;;
    $q-&gt;initial_show_criteria = &quot;hide&quot;;
    $q-&gt;access_mode = &quot;REPORTOUTPUT&quot;;
    $q-&gt;embedded_report = true;
    $q-&gt;session_namespace = &quot;GRAPH1&quot;;
    $q-&gt;show_refresh_button = true;
    $q-&gt;execute();

    // Run second report
    $q = new reportico();
    $q-&gt;allow_debug = true;
    $q-&gt;reportico_ajax_mode = true;
    $q-&gt;initial_project = &quot;myproject&quot;;
    $q-&gt;initial_project_password = &quot;password&quot;;
    $q-&gt;initial_report = &quot;graph2.xml&quot;;
    $q-&gt;initial_execute_mode = &quot;EXECUTE&quot;;
    $q-&gt;initial_show_detail = &quot;hide&quot;;
    $q-&gt;initial_show_graph = &quot;show&quot;;
    $q-&gt;initial_show_group_headers = &quot;hide&quot;;
    $q-&gt;initial_show_group_trailers = &quot;hide&quot;;
    $q-&gt;initial_show_column_headers = &quot;hide&quot;;
    $q-&gt;initial_show_criteria = &quot;hide&quot;;
    $q-&gt;access_mode = &quot;REPORTOUTPUT&quot;;
    $q-&gt;embedded_report = true;
    $q-&gt;session_namespace = &quot;GRAPH2&quot;;
    $q-&gt;show_refresh_button = true;
    $q-&gt;execute();

</pre></code></p><hr />

<a name="using.externalparams"></a><h3 class="title">Using external parameters and variables within reports</h3><p>If you want to pick up external system parameters such session variables or constants in tour reports you can set them in the main run.php or your own calling script. For example you might want to pass a user name,a user role or a site id. Just pass in</p>
<p><code><pre>
    $q-&gt;user_parameters[&quot;your_parameter_name&quot;] = &quot;your parameter value&quot;;
</pre></code></p>
<p>Then you can pick up in Reportico SQL queries using the construct {USER_PARAM,your_parameter_name}.</p><hr />

<a name="using.externaluser"></a><h3 class="title">Reporting by user</h3><p>Quite often you want to produce reports that show records relevant to the logged in user. This is especially relevant to an embedded solution. To do this you need to provide the currently logged on user in the external_user property. Then to make use of the user in your queries use the {FRAMEWORK_USER} notation. For example in your calling script put :-</p>
<p><code><pre>
            $q-&gt;external_user = $user;
            $q-&gt;execute();
</pre></code></p>
<p>Then you can pick up in Reportico SQL queries using the construct {FRAMEWORK_USER} e.g..</p>
<p><code><pre>
            SELECT x 
            FROM y
            WHERE 1 = 1
            AND userid = {FRAMEWORK_USER}
</pre></code></p><hr /></span>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="33%" align="left" valign="top"><a href="../reportico/tutorial_reportico.using.pkg.html">Prev</a></td>
<td width="34%" align="center" valign="top"><a href=
"../reportico/tutorial_reportico.manual.pkg.html">Up</a></td>
<td width="33%" align="right" valign="top"><a href=
"../reportico/tutorial_reportico.security.pkg.html">Next</a></td>
</tr>

<tr>
<td width="33%" align="left" valign="top">Configuring Reportico - System Parameters</td>
<td width="34%" align="center" valign="top">Reportico User Manual</td>
<td width="33%" align="right" valign="top">Reportico Security</td>
</tr>
</table>
        <div class="credit">
		    <hr />
		    Documentation generated on Mon, 09 Jun 2014 20:06:30 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
	      </div>
      </td></tr></table>
    </td>
  </tr>
</table>

</body>
</html>